package com.zmn.oms.business.impl.mq;

import com.alibaba.fastjson.JSONObject;
import com.zmn.common.utils.string.StringUtil;
import com.zmn.manager.mq.constant.MqTopicConsts;
import com.zmn.manager.mq.interfaces.ZmnMQSender;
import com.zmn.oms.business.interfaces.mq.MqProviderService;
import com.zmn.oms.common.constant.MessageQueueTagConsts;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 类描述
 *
 * @author fubiao
 * @since 2022/06/07
 */
@Service
public class MqProviderServiceImpl implements MqProviderService {

    @Resource
    private ZmnMQSender zmnMQSender;

    @Override
    public void sendEngineerWorkVersion(Integer engineerId, String version) {
        JSONObject map = new JSONObject();
        map.put("engineerId",engineerId.toString());
        map.put("version",version);
        String json = map.toJSONString();
        String randomsString = StringUtil.getRandomsString(32);
        zmnMQSender.send(MqTopicConsts.ZMN_TOPIC_OMS, MessageQueueTagConsts.ZMN_TAG_ENGINEER_VERSION,randomsString,json);
    }
}
